import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  { 
    path: '/',
    // component: () => import(/* webpackChunkName: "articlesList" */ '../components/layout.vue'),
    redirect: '/article-list',
    component(resolve) {
      require(['../components/layout.vue'], resolve);
    },
    children: [
      {
        path: '/article-list',
        // meta: {
        //   navIndex: 0
        // },
        name: 'article-list',
        // component: () => import(/* webpackChunkName: "articlesList" */ '../views/articles/list.vue')
        component(resolve) {
          require(['../views/articles/list.vue'], resolve);
        },
      },
      {
        path: '/article/detail',
        // meta: {
        //   navIndex: -1
        // },
        name: 'article-detail',
        // component: () => import(/* webpackChunkName: "articleDetail" */ '../views/articles/detail.vue')
        component(resolve) {
          require(['../views/articles/detail.vue'], resolve);
        },
      },
      {
        path: '/about',
        // meta: {
        //   navIndex: 1
        // },
        name: 'about',
        // component: () => import(/* webpackChunkName: "about" */ '../views/about.vue')
        component(resolve) {
          require(['../views/about.vue'], resolve);
        },
      },
      {
        path: '/create',
        // meta: {
        //   navIndex: 1
        // },
        name: 'create',
        // component: () => import(/* webpackChunkName: "about" */ '../views/about.vue')
        component(resolve) {
          require(['../views/articles/create.vue'], resolve);
        },
      },
      {
        path: '/user',
        // meta: {
        //   navIndex: 1
        // },
        name: 'user',
        // component: () => import(/* webpackChunkName: "about" */ '../views/about.vue')
        component(resolve) {
          require(['../views/user/index.vue'], resolve);
        },
      },
      {
        path: '/favourite',
        // meta: {
        //   navIndex: 1
        // },
        name: 'favourite',
        // component: () => import(/* webpackChunkName: "about" */ '../views/about.vue')
        component(resolve) {
          require(['../views/favourite/index.vue'], resolve);
        },
      },
      {
        path: '/mine',
        // meta: {
        //   navIndex: 1
        // },
        name: 'mine',
        // component: () => import(/* webpackChunkName: "about" */ '../views/about.vue')
        component(resolve) {
          require(['../views/mine/index.vue'], resolve);
        },
      },
    ]
  },

  {
    path: '/login',
    // meta: {
    //   navIndex: 2
    // },
    name: 'login',
    component(resolve) {
      require(['../views/login.vue'], resolve);
    },
    // component: () => import(/* webpackChunkName: "about" */ '../views/login.vue')
  },
]



export default routes
